home *** CD-ROM | disk | FTP | other *** search
/ Champak 145 / (Vol 145) Dec 21 2011.iso / Games / kupidon-strike.swf / scripts / frame_203 / PlaceObject2_348_611 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2011-12-21  |  4.2 KB  |  124 lines

  1. onClipEvent(enterFrame){
  2.    if(move_delay >= 0)
  3.    {
  4.       move_delay--;
  5.    }
  6.    if(this.moveble && move_delay < 0)
  7.    {
  8.       if(c_path <= 0)
  9.       {
  10.          move_direction = -1;
  11.       }
  12.       if(c_path >= move_path)
  13.       {
  14.          move_direction = 1;
  15.       }
  16.       if(move_direction == 1)
  17.       {
  18.          c_path -= move_speed;
  19.          _X = _X + move_speed * Math.sin(move_angle * 0.017453292519943295);
  20.          _Y = _Y - move_speed * Math.cos(move_angle * 0.017453292519943295);
  21.       }
  22.       if(move_direction == -1)
  23.       {
  24.          c_path += move_speed;
  25.          _X = _X - move_speed * Math.sin(move_angle * 0.017453292519943295);
  26.          _Y = _Y + move_speed * Math.cos(move_angle * 0.017453292519943295);
  27.       }
  28.    }
  29.    if(!_root.gameplay)
  30.    {
  31.       if(hitted)
  32.       {
  33.          if(_root.stoned)
  34.          {
  35.             hitted = false;
  36.          }
  37.          else
  38.          {
  39.             _root.do_sound("sHeart-steel",true);
  40.             _root.bullet.vector = newa;
  41.             hitted = false;
  42.             to = false;
  43.             trace(to);
  44.             setTimeout(setto,100);
  45.             _root.wl = "empty";
  46.          }
  47.       }
  48.       x = Math.abs(_root.bullet._x + _root.bullet.vector.x * 0.9800000000000004 - (this._x + 12.5));
  49.       y = Math.abs(_root.bullet._y - _root.bullet.vector.y * 0.9800000000000004 - _root.gravity - (this._y + 12.5));
  50.       if(Math.sqrt(x * x + y * y) <= 25 && pretest && to)
  51.       {
  52.          delta_x = this._x + this._width / 2 - _root.bullet._x;
  53.          delta_y = this._y + this._height / 2 - _root.bullet._y;
  54.          a = (- Math.atan2(delta_x,delta_y)) / 0.017453292519943295;
  55.          if(a > hAngle1 && a < hAngle2 or a > hAngle3 && a < hAngle4 or a > hAngle5 && a < hAngle6)
  56.          {
  57.             anglex = 1;
  58.             angley = -0.9000000000000002;
  59.             angle = a;
  60.             pretest = false;
  61.          }
  62.          else if(a >= wAngle1 && a <= wAngle2 or a >= wAngle3 && a <= wAngle4 or a >= wAngle5 && a <= wAngle6)
  63.          {
  64.             anglex = -0.9000000000000002;
  65.             angley = 1;
  66.             angle = a;
  67.             pretest = false;
  68.          }
  69.       }
  70.       ti = 1;
  71.       while(ti < 6)
  72.       {
  73.          x = _root.bullet._x + _root.bullet.vector.x / ti * 0.9800000000000004;
  74.          y = _root.bullet._y - _root.bullet.vector.y / ti * 0.9800000000000004 - _root.gravity;
  75.          if(this.hitTest(x,y,true) && to)
  76.          {
  77.             delta_x = this._x + this._width / 2 - _root.bullet._x;
  78.             delta_y = this._y + this._height / 2 - _root.bullet._y;
  79.             a = (- Math.atan2(delta_x,delta_y)) / 0.017453292519943295;
  80.             if(a > hAngle1 && a < hAngle2 or a > hAngle3 && a < hAngle4 or a > hAngle5 && a < hAngle6)
  81.             {
  82.                anglex = 1;
  83.                angley = -0.9000000000000002;
  84.                angle = a;
  85.                newa = {x:_root.bullet.vector.x * anglex,y:_root.bullet.vector.y * angley};
  86.                pretest = true;
  87.             }
  88.             else if(a > wAngle1 && a < wAngle2 or a > wAngle3 && a < wAngle4 or a > wAngle5 && a < wAngle6)
  89.             {
  90.                anglex = -0.9000000000000002;
  91.                angley = 1;
  92.                angle = a;
  93.                newa = {x:_root.bullet.vector.x * anglex,y:_root.bullet.vector.y * angley};
  94.                pretest = true;
  95.             }
  96.             else if(a > dAngle1 && a < dAngle2 or a > dAngle3 && a < dAngle4)
  97.             {
  98.                anglex = -0.9000000000000002;
  99.                angley = -0.9000000000000002;
  100.                angle = a;
  101.                newa = {x:_root.bullet.vector.x * anglex,y:_root.bullet.vector.y * angley};
  102.                pretest = true;
  103.             }
  104.             hitted = true;
  105.             break;
  106.          }
  107.          ti++;
  108.       }
  109.       i = 0;
  110.       while(i < _root.tohit.length)
  111.       {
  112.          if(this.active && _root[_root.tohit[i]].active && this.hitTest(_root[_root.tohit[i]]._x,_root[_root.tohit[i]]._y,true))
  113.          {
  114.             obj = _root.tohit[i];
  115.             _root.do_sound("sHeart-steel",true);
  116.             _root[obj].speed = 0;
  117.             _root[obj].active = false;
  118.             _root[obj].gotoAndPlay(2);
  119.          }
  120.          i++;
  121.       }
  122.    }
  123. }
  124.